﻿<Window x:Class="AGMLite.Windows.ProjectEditWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Name="winProjectEdit"
        Title="HP Agile Management Lite - Project Edit" Height="330" Width="400" Icon="/AGMLite;component/images/agm.ico" Closed="winProjectEdit_Closed">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary>
                    <Style TargetType="Control" x:Key="myErrorTemplate">
                        <Style.Triggers>
                            <Trigger Property="Validation.HasError" Value="true">
                                <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                    <Style TargetType="TextBox" BasedOn="{StaticResource myErrorTemplate}" />
                    <Style TargetType="CheckBox" BasedOn="{StaticResource myErrorTemplate}" />
                    <Style TargetType="ComboBox" BasedOn="{StaticResource myErrorTemplate}" />
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">
            <StackPanel Orientation="Horizontal" Margin="4">
                <TextBlock Text="Project Name:" Width="150" VerticalAlignment="Center"></TextBlock>
                <TextBox Name="txtName" Width="200" Text="{Binding Project.Name, UpdateSourceTrigger=LostFocus, Mode=TwoWay, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"></TextBox>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="4">
                <TextBlock Text="Server Address:" Width="150" VerticalAlignment="Center"></TextBlock>
                <TextBox Name="txtServer" Width="200" Text="{Binding Project.Server, UpdateSourceTrigger=LostFocus, Mode=TwoWay, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"></TextBox>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="4">
                <TextBlock Text="User Name:" Width="150" VerticalAlignment="Center"></TextBlock>
                <TextBox Name="txtUsername" Width="200" Text="{Binding Project.Username, UpdateSourceTrigger=LostFocus, Mode=TwoWay, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"></TextBox>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="4">
                <TextBlock Text="Password:" Width="150" VerticalAlignment="Center"></TextBlock>
                <TextBox Name="txtPassword" Width="200" Text="{Binding Project.Password, UpdateSourceTrigger=LostFocus, Mode=TwoWay, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"></TextBox>
            </StackPanel>            
            <StackPanel Orientation="Horizontal" Margin="4">
                <TextBlock Text="Domain:" Width="150" VerticalAlignment="Center"></TextBlock>
                <TextBox Name="txtDomain" Width="200" Text="{Binding Project.Domain, UpdateSourceTrigger=LostFocus, Mode=TwoWay, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"></TextBox>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="4">
                <TextBlock Text="Project:" Width="150" VerticalAlignment="Center"></TextBlock>
                <TextBox Name="txtProject" Width="200" Text="{Binding Project.Project, UpdateSourceTrigger=LostFocus, Mode=TwoWay, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"></TextBox>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="4">
                <TextBlock Text="Icon:" Width="150" VerticalAlignment="Center"></TextBlock>
                <TextBox Name="txtIcon" Width="200" Text="{Binding Project.Icon}"></TextBox>
                <Button Name="btnIconUpload" Width="18" Margin="2" Content="..." Command="{Binding OpenFileCommand}"></Button>
            </StackPanel>            
            <StackPanel Orientation="Horizontal" Margin="4" HorizontalAlignment="Center">
                <Button Name="btnSave" Width="70" Margin="2" Content="Save" Command="{Binding SaveCommand}" CommandParameter="{Binding ElementName=winProjectEdit}"></Button>
                <Button Name="btnCancel" Width="70" Margin="2" Content="Cancel" Command="{Binding CancelCommand}" CommandParameter="{Binding ElementName=winProjectEdit}"></Button>
            </StackPanel>
        </StackPanel>
    </Grid>
</Window>
